
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <link href="/static/devtools30/layui/css/layui.css" rel="stylesheet" />
    <link href="/static/devtools30/css/devindexbase.css" rel="stylesheet" />
    <script src="/static/devtools30/js/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="/static/devtools30/layui/layui.all.js" type="text/javascript"></script>
    <script src="/static/devtools30/js/devtoolCommon.js" type="text/javascript"></script>
    <title>新增功能</title>
    <style>
        /*页面内边距*/
        .addwrap {
            padding: 30px;
        }
        /*按钮组边框*/
        .layui-btn-primary {
            border: 1px solid #C9C9C9!important;
        }
        /*输入框高度*/
        .addwrap .layui-input,
        .layui-select {
            height: 25px;
        }

        .addwrap .layui-input-block {
            min-height: 26px;
            margin-left: 30px;
        }

        .addwrap .layui-form-label {
            padding: 0;
            text-align: right;
            height: 26px;
            line-height: 26px;
            width: 80px;
        }
        .layui-form-radio>i {
            font-size: 17px !important;
        }
        .layui-form-radio {
            line-height: 12px !important;
        }
        .layui-form-radio * {
            font-size: 12px;
        }
        .layui-form-item .layui-form-checkbox[lay-skin=primary] {
            margin-top: 3px !important;
        }
        .layui-form-checkbox span {

            font-size: 12px !important;
        }
    </style>
</head>
<body>
<div class="addwrap">
    <di class="layui-form" lay-filter="form" >

        <input type="hidden" name="id" id="id" class="layui-input" th:value="${data.id}">


        <div class="flex flex-jusity-betreen flex-align-center height26" style="width: 400px  !important; margin-left: 28px">
            <div class="layui-form-item flex">
                <label class="layui-form-label">分类</label>
                <div class="layui-input-block marginleft10">
                    <select name="flid" id="flid" lay-verify="required" >
                        <option th:each="c : ${flList}"  th:value="${c.id}" th:utext="${c.name}">
                        </option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item flex" id="typediv">
                <label class="layui-form-label">是否启用</label>
                <div class="layui-input-block marginleft10" >
                    <input id="active" type="checkbox" name="active" value="1" th:checked="${data.active eq 1} ? 'checked' :'false'" title="启用" lay-skin="primary"  />
                </div>
            </div>
        </div>
        <div class="height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block marginleft10" style="width: 375px!important;">
                    <input type="text" name="name" id="name" th:value="${data.name}" placeholder="请输入名称" autocomplete="off" class="layui-input">

                </div>
            </div>
        </div>

        <div class="height26" style="display: none">
            <div class="layui-form-item flex">
                <label class="layui-form-label">风格</label>
                <div class="layui-input-block marginleft10" style="width: 375px!important;">
                    <input id="stytle1" type="radio" name="stytle" value="1" checked title="layui风格" />
                </div>
            </div>
        </div>
        <div class="height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">分页</label>
                <div class="layui-input-block marginleft10" style="width: 375px!important;">
                    <input id="page1" type="radio" name="pageflag" th:checked="${data.pageflag eq 1} ? 'checked' :'false'" value="1" checked title="不分页" />
                    <input id="page2" type="radio" name="pageflag" th:checked="${data.pageflag eq 2} ? 'checked' :'false'" value="2" title="前台分页"/>
                    <input id="page3" type="radio" name="pageflag" th:checked="${data.pageflag eq 3} ? 'checked' :'false'" value="3" title="后台分页" />
                </div>
            </div>
        </div>
        <div class="height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">按钮显示</label>
                <div class="layui-input-block marginleft10" >

                    <input id="searchBtnCfg"  th:checked="${searchBtnCfg eq '1'} ? 'checked' :'false'"  type="checkbox" name="searchBtnCfg" lay-skin="primary" value="1" title="查询" />
                    <input id="addBtnCfg" th:checked="${addBtnCfg eq '1'} ? 'checked' :'false'"  type="checkbox" name="addBtnCfg" value="1" lay-skin="primary" title="新增" />
                    <input id="editBtnCfg" th:checked="${editBtnCfg eq '1'} ? 'checked' :'false'"  type="checkbox" name="editBtnCfg" lay-skin="primary" title="编辑" value="1" />
                    <input id="delBtnCfg" th:checked="${delBtnCfg eq '1'} ? 'checked' :'false'"  type="checkbox" name="delBtnCfg" lay-skin="primary" title="删除" value="1" />
                    <input id="importBtnCfg"  th:checked="${importBtnCfg eq '1'} ? 'checked' :'false'"  type="checkbox" name="importBtnCfg" lay-skin="primary" title="导出" value="1" />

                </div>

            </div>
        </div>
        <div class="height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">模型选择</label>
                <div class="layui-input-block marginleft10" >
                    <select name="metatablesel" id="metatablesel" lay-verify="required" >
                        <option th:each="c : ${mtableList}"  th:value="${c.id}" th:utext="${c.name}" th:selected="${mtableid} eq ${c.id} ">
                        </option>
                    </select>
                </div>

            </div>
        </div>
        <div class="height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">SQL模式</label>
                <div class="layui-input-block marginleft10" >
                    <select name="sqltype" id="sqltype"  >
                        <option value="replaceconcat">替换拼接</option>
                        <option value="precompile">预编译</option>
                    </select>
                </div>

            </div>
        </div>
        <div class="layui-form-item layui-form-text flex">
            <!--<div class="marginbottom10">备注</div>-->
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block" style="width: 375px!important;">
                <textarea name="bz" id="bz" placeholder="请输入备注" class="layui-textarea">[(${data.bz})]</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block flex flex-jusity-around tjbtn">
                <button class="layui-btn layui-btn-radius layui-btn-sm layui-btn-primary qx" onclick="closeWin()">取消</button>
                <button class="layui-btn layui-btn-radius layui-btn-sm " lay-submit lay-filter="save">保存</button>
            </div>
        </div>
    </di>
</div>
</body>
<script>
    var formid=dlCommon.getUrlParam("formid");
    $(function(){
        initEvent();
    });
    function closeWin(){
        dlCommon.closeParentLayer();
    }

    function initEvent(){
        layui.form.on('submit(save)', function(data){
            saveData();
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        if(dlCommon.getUrlParam("flid")){
            $("#flid option[value='"+dlCommon.getUrlParam("flid")+"']").attr("selected", "selected");
        }
        $("#flid option[value='[(${data.flid})]']").attr("selected", "selected");
        $("#sqltype option[value='[(${data.sqltype})]']").attr("selected", "selected");

        layui.form.render();
    }
    function saveData(){
        var data = layui.form.val('form');
        data.issubform=0;
        if(data.active==undefined){
            data.active=0;
        }
        if(data.searchBtnCfg==undefined){
            data.searchBtnCfg=0;
        }
        if(data.addBtnCfg==undefined){
            data.addBtnCfg=0;
        }
        if(data.delBtnCfg==undefined){
            data.delBtnCfg =0;
        }
        if(data.editBtnCfg==undefined){
            data.editBtnCfg=0;
        }
        if(data.importBtnCfg==undefined){
            data.importBtnCfg=0;
        }
        if(formid){
            data.formId=formid;
            data.issubform=1;
        }

        dlCommon.post("/DevtFormListTemplateController/save",data,function(res){
            if(!res.success){
                dlCommon.layerError(res.msg);
                return;
            }
            dlCommon.layerSuccess("保存成功",function(){
                parent.getDataList();
                closeWin();
            })
        },true)
    }
</script>

</html>